home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / indexing / IXAttributeParser.h < prev    next >
Text File  |  1994-04-13  |  4KB  |  103 lines

  1. /*
  2. IXAttributeParser.h
  3. Copyright 1991, NeXT Computer, Inc.
  4. */
  5.  
  6. #import    <objc/Object.h>
  7. #import    <objc/hashtable.h>
  8. #import    <dpsclient/dpsclient.h>
  9.  
  10. #import    "protocols.h"
  11.  
  12. @class List, IXAttributeBinder, IXFileConverter, IXWeightingDomain;
  13.  
  14. // These atoms define standard attributes generated by the attribute parser.
  15.  
  16. extern NXAtom    IXDefaultAttribute;
  17. extern NXAtom    IXContentAttribute;
  18.  
  19. // These atoms define pasteboard types used by the attribute parser.  The 
  20. // former is the for the tokenized format produced by attribute readers.  The 
  21. // latter is for file descriptions generated by pasteboard file filters.
  22.  
  23. extern NXAtom    IXAttributeReaderPboardType;
  24. extern NXAtom    IXFileDescriptionPboardType;
  25.  
  26. // These are the types of weighting applied to tokens by the attribute parser.  
  27. // Absolute weighting produces weights representing the number of occurrences 
  28. // of the token.  Frequency weighting produces weights representing the count 
  29. // divided by the total number of tokens in the sample.  Peculiarity weighting 
  30. // produces weights representing the frequency relative to a weighting domain.
  31.  
  32. typedef enum {
  33.     IX_NoWeighting = 0, 
  34.     IX_AbsoluteWeighting, IX_FrequencyWeighting, IX_PeculiarityWeighting 
  35. } IXWeightingType;
  36.  
  37. @interface IXAttributeParser: Object <IXAttributeBinding>
  38. {
  39.     BOOL        _tokenUniquing;
  40.     NXHashTable        *_sourceTypes;
  41.     id            _attributeBinder;
  42.     id            _fileConverter;
  43.     List        *_attributeMapping;
  44.     List        *_attributeReaders;
  45.     IXWeightingType    _weightingType;
  46.     IXWeightingDomain    *_weightingDomain;
  47.     unsigned        _minimumWeight;
  48.     unsigned        _percentPassed;
  49. }
  50.  
  51. // This method returns a DPSPortProc that does pasteboard access in the main 
  52. // thread of an appkit program, and takes the port that the proc will wait on.
  53. + (DPSPortProc)getFilterHandler:(port_t)filterPort;
  54.  
  55. // These methods manage the list of attribute readers.  The source stream is 
  56. // pipelined through the list of readers in the order in which they appear.
  57.  
  58. - getAttributeReaders:(List *)aList; // fills the list with installed readers.
  59. - setAttributeReaders:(List *)aList; // sets the readers from the supplied list.
  60.  
  61. - (BOOL)understandsType:(const char *)type; // always yes until types are added
  62. - addSourceType:(const char *)type; // adds to the set of understood types
  63. - removeSourceType:(const char *)type; // removes a previously understood type
  64.  
  65. @end
  66.  
  67. @interface IXAttributeParser(Parsing)
  68.  
  69. - reset; // clears the accumulated attribute bindings
  70.  
  71. // if type is NULL or empty, this method will type the file
  72. - parseFile:(const char *)filename ofType:(const char *)type;
  73. - parseStream:(NXStream *)stream ofType:(const char *)type;
  74.  
  75. // These methods pass the source through the list of attribute parsers, 
  76. // producing attribute reader format, rather than attribute bindings.
  77.  
  78. // if type is NULL or empty, this method will type the file
  79. - (NXStream *)analyzeFile:(const char *)filename ofType:(const char *)type;
  80. - (NXStream *)analyzeStream:(NXStream *)stream ofType:(const char *)type;
  81.  
  82. @end
  83.  
  84. @interface IXAttributeParser(Configuration)
  85.  
  86. - (unsigned)minimumWeight; // returns minimum weight
  87. - setMinimumWeight:(unsigned)aMinimum; // sets minimum weight
  88.  
  89. - (unsigned)percentPassed; // returns per centage passed
  90. - setPercentPassed:(unsigned)aPercent; // sets per centage passed
  91.  
  92. - (IXWeightingDomain *)weightingDomain; // returns weighting domain
  93. - setWeightingDomain:(IXWeightingDomain *)aDomain; // sets weighting domain
  94.  
  95. - (IXWeightingType)weightingType; // returns weighting type 
  96. - setWeightingType:(IXWeightingType)type; // sets weighting type
  97.  
  98. - (IXFileConverter *)fileConverter; // returns file converter
  99. - setFileConverter:(IXFileConverter *)aConverter; // sets file converter
  100.  
  101. @end
  102.  
  103.